import { createStore, applyMiddleware } from 'redux'
import RootReducer from './reducers/root.reducers'
// import logger from './middleware/logger'
// import test from './middleware/test'
// import thunk from './middleware/thunk'
// import reduxThunk from 'redux-thunk'
import createSagaMiddleware from 'redux-saga'
import modalSaga from './sagas/modal.saga'
import rootSaga from './sagas/root.saga'

// 注册中间件
// applyMiddleware(logger)

// 创建sagaMiddleware
const sagaMiddleware = createSagaMiddleware();

// export const store = createStore(RootReducer, applyMiddleware(logger, test, thunk))
// export const store = createStore(RootReducer, applyMiddleware(reduxThunk))
export const store = createStore(RootReducer, applyMiddleware(sagaMiddleware))

// 启动modalSaga
// sagaMiddleware.run(modalSaga)
sagaMiddleware.run(rootSaga)